package zredis

import (
	"github.com/gomodule/redigo/redis"
	"time"
)

var (
	_addr string
	_pass string
	_db   int
)
var pool *redis.Pool

// autoClose 自动关闭
func autoClose(conn redis.Conn) {
	err := conn.Close()
	if err != nil {
	}
}

func dial() (redis.Conn, error) {
	conn, err := redis.Dial("tcp", _addr,
		redis.DialPassword(_pass),
		redis.DialDatabase(_db),
		redis.DialConnectTimeout(5*time.Second),
		redis.DialReadTimeout(5*time.Second),
		redis.DialWriteTimeout(5*time.Second),
	)
	return conn, err
}
